package com.leet.code.lcof;

import java.util.Arrays;

public class Code60 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Code60().dicesProbability(3)));

    }

    public double[] dicesProbability(int n) {
        double[] result = {1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0, 1.0 / 6.0};
        for (int i = 2; i <= n; i++) {
            double[] tmp = new double[5 * i + 1];
            for (int a = 0; a < result.length; a++) {
                for (int j = 0; j < 6; j++) {
                    tmp[a + j] += result[a] / 6.0;
                }
            }
            result = tmp;
        }
        return result;
    }


}
